import { BasicColumn, FormSchema } from '/@/components/Table';

export const Permission = {
  ADD: 'microresource.author.add',
  EDIT: 'microresource.author.edit',
  DEL: 'microresource.author.del',
};

export const columns: BasicColumn[] = [
  {
    title: '姓名',
    dataIndex: 'name',
  },
  {
    title: '头像',
    dataIndex: 'avatar',
  },
  {
    title: '自我介绍',
    dataIndex: 'selfIntroduction',
  },
  {
    title: '创建时间',
    dataIndex: 'createAt',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '姓名',
    component: 'Input',
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '姓名',
    component: 'Input',
    rules: [
      { required: true, message: '请填写姓名' },
      { max: 100, message: '姓名最多100字' },
    ],
  },
  {
    field: 'file',
    label: '选择文件',
    component: 'Upload',
    componentProps: {
      maxSize: 100,
      maxNumber: 1,
      accept: ['jpg', 'jpeg', 'png', 'gif'],
      multiple: false,
    },
  },
  {
    field: 'selfIntroduction',
    label: '自我介绍',
    component: 'InputTextArea',
    rules: [{ max: 255, message: '自我介绍最多255字' }],
  },
];
